package com.github.bobjoy.java.thread.concurrent;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class CopyOnWriteArrayDemo {

    @Test
    public void test() {

        List<String> list = new CopyOnWriteArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        list.add("5");
        for (String s : list) {
            list.remove(s);
        }

        Collections.synchronizedList(new ArrayList<>());
    }

}
